import request from '@/service/index'
import type { IModlieCode, IAccountLogin, ICodeLogin } from './type'

// 获取验证码
export const getSendCode = (params: IModlieCode) => {
  return request.get<any>({
    url: 'admin/send-user-mobile',
    params
  })
}

// 密码登录
export const postAccountLogin = (data: IAccountLogin) => {
  return request.post<any>({
    url: 'admin/login_account_code',
    data
  })
}

// 验证码登录
export const postCodeLogin = (data: ICodeLogin) => {
  return request.post<any>({
    url: 'admin/login-code',
    data
  })
}

// 用户信息
export const postUserInfo = () => {
  return request.post<any>({
    url: 'admin/login-user'
  })
}

// 校验验证码
export const getValidateMobileCode = (params: {
  mobile: string
  captchaCode: string
  randomCode: string
}) => {
  return request.post<any>({
    url: 'admin/validate-mobile',
    params
  })
}

// 短链接合同信息
export const getContractLinkAddress = (params: {
  contractLinkAddress: string
}) => {
  return request.get<any>({
    url: 'm/get-contractinfo-by-contractlinkaddress',
    params
  })
}
